﻿
CREATE PROCEDURE [dbo].[P_OBTERLISTA_T08_PREDIO]
	@cd_predio [int]
   ,@ds_identificacao [varchar](50)
   ,@ds_endereco [varchar](100)
   ,@sg_estado [varchar](5)
   
AS
BEGIN
	SELECT
	T.cd_predio
    ,T.ds_identificacao
    ,T.ds_endereco
    ,T.sg_estado
    
  FROM T08_PREDIO T
  WHERE
    (cd_predio = @cd_predio OR @cd_predio IS NULL)
    AND (ds_identificacao like '%' + @ds_identificacao + '%'  OR @ds_identificacao IS NULL)
    AND (ds_endereco = @ds_endereco OR @ds_endereco IS NULL)
    AND (sg_estado = @sg_estado OR @sg_estado IS NULL)
    
END